package myenum.enum01;


/**
 * 自定义枚举类
 * 季节：春夏秋冬
 *
 * 它的父类是Object
 */
public class SeasonEnum01 {
    /**
     * 属性 固定属性值 不可修改
     */
    // 名称
    private final String name;
    // 描述
    private final String desc;

    /**
     * 通过构造方法 暴露出去
     */
    private SeasonEnum01(String name, String desc){
        this.name = name;
        this.desc = desc;
    }

    public static final SeasonEnum01 SPRING = new SeasonEnum01("春天","春暖花开");
    public static final SeasonEnum01 SUMMER = new SeasonEnum01("夏天","烈日炎炎");
    public static final SeasonEnum01 AUTUMN = new SeasonEnum01("秋天","硕果累累");
    public static final SeasonEnum01 WINTER = new SeasonEnum01("冬天","冰天雪地");


    /**
     * 暴露public 方法 获取属性
     * @return
     */
    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 重写 toString方法
     * @return
     */
    @Override
    public String toString() {
        return "TestSeason{" +
                "name='" + name + '\'' +
                ", desc='" + desc + '\'' +
                '}';
    }
}
